<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateSpecialAuditExamFile extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table = $this->table('special_audit_exam_file', ['comment' => '专项审核问卷文件表']);
        $table
            ->addColumn('special_audit_exam_id', 'integer',array('limit' => 30,'default' => 0,'comment' => '审核问卷表id'))
            ->addColumn('user_id', 'integer',array('limit' => 30, 'default' => 0,'comment' => '提交人id'))
            ->addColumn('exam_id', 'integer',array('limit' => 50,'default' => 0,'comment' => '问卷id'))
            ->addColumn('exam_stair_type_id', 'integer', array('limit' => 30, 'default' => 1, 'comment' => '一级'))
            ->addColumn('exam_second_level_id', 'integer', array('limit' => 30, 'default' => 1, 'comment' => '二级'))
            ->addColumn('exam_detail_id', 'integer', array('limit' => 30, 'default' => 1, 'comment' => '具体细则表id'))
            ->addColumn('file_path', 'string', array('limit' => 220,'null' => true, 'comment' => '问卷文件表'))
            ->addColumn('content', 'text', array('null' => true, 'comment' => '描述'))
            ->addColumn('date_of', 'string', array('limit' => 220, 'null' => true, 'comment' => '日期'))
            ->addColumn('ultimately_score', 'decimal', array('precision' => 5,'scale' => 2,'default' => 0, 'comment' => '最终得分'))
            ->addColumn('is_audit', 'boolean', array('limit' => 1,  'default' => 0, 'comment' => '是否审核（0or1）'))
            ->addColumn('reason', 'string', array('limit' => 220,'null' => true,'comment' => '扣分原因'))
            ->addColumn('audit_way', 'boolean', array('limit' => 1,'default' => 0, 'comment' => '审核方式通过or扣分（1or2）'))
            ->addColumn('unit_id', 'integer',array('limit' => 30, 'default' => 0,'comment' => '所属单位id'))
            ->addColumn('attribute', 'boolean', array('limit' => 1, 'default' => 0, 'comment' => '属性 0 1 2 3默认/邮政/综合/专项'))
            ->addTimestamps()
            ->addSoftDelete()
            ->create();
    }
}
